package com.frogs.ucenter.v1.request;


import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.util.StringUtil;
import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.util.HonorRefEnum;
import com.frogs.system.util.HonorTypeEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;


/**
 * 用户荣誉添加请求参数类
 *
 * @author jzkangta
 */
public class UserHonorAddRequest extends Request {

	 /**
	 * 
	 */
	private static final long serialVersionUID = -7800837710009584651L;
	private Integer userId = 0;//蛙鸣用户id
	 private Integer honorType = -1;
	 private Integer honorScore = 0;//分值
	 private String detail;
	 private Integer targetUserId=0;
	 private String appId = "";
	 private Integer openPlatformId = -1;
	 
	
	public UserHonorAddRequest() {
		
	}
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), 0);
		this.honorType = requestInfo.getIntParameter(ApiUrlParamEnum.honorType.getParamName(), HonorTypeEnum.XIAO_XIN.getId());
		this.honorScore = requestInfo.getIntParameter(ApiUrlParamEnum.honorScore.getParamName(), 0);
		this.detail = requestInfo.getParameter(ApiUrlParamEnum.detail.getParamName(), HonorRefEnum.TI_XING_CL.getName());
		this.targetUserId = requestInfo.getIntParameter(ApiUrlParamEnum.targetUserId.getParamName(), 0);
		this.appId = requestInfo.getParameter(ApiUrlParamEnum.appId.getParamName(), null);
		this.openPlatformId = requestInfo.getIntParameter(ApiUrlParamEnum.openPlatformId.getParamName(), -1);
		if(userId == 0 ) {
			throw new RequestIllegalException("传递错误的参数，请确认userId不能为空!");
		}
		if(honorType < 0 ) {
			throw new RequestIllegalException("传递错误的参数，请确认honorType不能为空!");
		}
		if(honorScore == 0 ) {
			throw new RequestIllegalException("传递错误的参数，请确认honorScore不能为空!");
		}
		if (StringUtil.isEmpty(detail)) {
			throw new RequestIllegalException("传递错误的参数，请确认detail不能为空!");
		}
		if(appId == null) {
			throw new RequestIllegalException("传递错误的参数，请确认appId不能为空!");
		}
		if(openPlatformId < 0 ) {
			throw new RequestIllegalException("传递错误的参数，请确认openPlatformId不能为空!");
		}
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public Integer getHonorType() {
		return honorType;
	}

	public void setHonorType(Integer honorType) {
		this.honorType = honorType;
	}

	public Integer getHonorScore() {
		return honorScore;
	}

	public void setHonorScore(Integer honorScore) {
		this.honorScore = honorScore;
	}

	public String getDetail() {
		return detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

	public Integer getTargetUserId() {
		return targetUserId;
	}

	public void setTargetUserId(Integer targetUserId) {
		this.targetUserId = targetUserId;
	}

	public String getAppId() {
		return appId;
	}

	public void setAppId(String appId) {
		this.appId = appId;
	}

	public Integer getOpenPlatformId() {
		return openPlatformId;
	}

	public void setOpenPlatformId(Integer openPlatformId) {
		this.openPlatformId = openPlatformId;
	}


	
}
